package cn.com.sinosoft.controller;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.sinosoft.model.UserEntity;
import cn.com.sinosoft.service.UserService;
import cn.com.sinosoft.util.ResponseData;

@Controller
@RequestMapping(value="user")
public class UserController {
	@Autowired
	UserService userService;
	
	@RequestMapping(value="/addUser" , method=RequestMethod.POST)
	public String addUser(UserEntity user){
		System.out.println("进入添加界面");
		user.setId(UUID.randomUUID().toString());
		userService.addUser(user);
		return "success";//返回成功页面
	}
	
	@RequestMapping(value="/queryUser" , method=RequestMethod.GET)
	public String queryUser(UserEntity user){
		List<UserEntity> users=userService.queryUser(user);
		for(UserEntity user1:users){
			System.out.println(user1);
		}
		return "success";
	}
}
